<?php

namespace Part07_ProxyPattern\Code3;

include_once 'GiveGift.php';
include_once 'Pursuit.php';

class Proxy implements GiveGift
{
    private $schoolGirl;
    private $proxyName;
    private $pursuitName;
    private $pursuitObj;

    public function __construct($proxyName, $pursuitName, $schoolGirl)
    {
        $this->proxyName = $proxyName;
        $this->pursuitName = $pursuitName;
        $this->schoolGirl = $schoolGirl;
        $this->pursuitObj = new Pursuit($this->pursuitName, $schoolGirl);
        echo "[$proxyName]帮[$pursuitName]送礼物给[$schoolGirl]\n\n";
    }

    public function giveDolls()
    {
        $this->pursuitObj->giveDolls();
        echo $this->proxyName . '帮' . $this->pursuitName . '送了洋娃娃给' . $this->schoolGirl . "\n\n";
    }

    public function giveFlowers()
    {
        $this->pursuitObj->giveFlowers();
        echo $this->proxyName . '帮' . $this->pursuitName . '送了鲜花给' . $this->schoolGirl . "\n\n";
    }

    public function giveChocolate()
    {
        $this->pursuitObj->giveChocolate();
        echo $this->proxyName . '帮' . $this->pursuitName . '送了巧克力给' . $this->schoolGirl . "\n\n";
    }
}